/*function gh(){
	document.getElementsByTagName("div")[1].style.display="none";
}
function gh2(){
	document.getElementsByTagName("div")[0].style.backgroundColor="red";
}
*/


var timer = null,
    index = 0,
    pics = document.getElementsByTagName("div"),
    lis = document.getElementsByTagName("li");

function gg(){
    timer = setInterval(function(){
    	index++;
        if(index>=lis.length){
            index = 0;
        }
        gg2();
    },1000);
}

//改变轮播图
function gg2(){
    for(var i=0;i<pics.length;i++){
        pics[i].style.display = "none";
        lis[i].className = "";
    }
    pics[index].style.display = "block";
    lis[index].className = "di";
}









//封装一个代替getElementById()的方法
/*function byId(id){
    return typeof(id) === "string"?document.getElementById(id):id;
}
 
function slideImg() {
    var main = byId("main");
    var banner = byId("banner");
    main.onmouseover = function(){
        stopAutoPlay();
    }
    main.onmouseout = function(){
        startAutoPlay();
    }
    main.onmouseout();*/

//暂停播放
/*function stopAutoPlay(){
    if (timer) {
        clearInterval(timer);
    }
}*/